package aspirecn.project3.mapper;

import aspirecn.project3.model.GoodsCategory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface GoodsCategoryMapper {

    @Insert("insert into good_category (CATEGORY_NAME,DESCRIPTION,CATEGORY_TYPE,PARENT_CATEGORY)" +
            "VALUES (#{CATEGORY_NAME},#{CATEGORY_TYPE},#{DESCRIPTION},#{PARENT_CATEGORY})")
    void save(GoodsCategory goodsCategory);

    @Select("select * from good_category where CATEGORY_TYPE = '1'")
    List<GoodsCategory> getListOne();

    @Select("select * from good_category where PARENT_CATEGORY = #{id}")
    List<GoodsCategory> getListByParent(Long id);
}
